import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '申请人信息',
    align:"center",
    dataIndex: 'sourcePersonInfo',
    slots: { customRender: 'sourcePersonInfo' }
   },
   {
    title: '申请人班次信息',
    align:"center",
    dataIndex: 'sourceClazzInfo',
    slots: { customRender: 'sourceClazzInfo' }
   },
   {
    title: '换班人信息',
    align:"center",
    dataIndex: 'targetPersonInfo',
    slots: { customRender: 'targetPersonInfo' }
   },
   {
    title: '换班人班次信息',
    align:"center",
    dataIndex: 'targetClazzInfo',
    slots: { customRender: 'targetClazzInfo' }
   },
   {
    title: '审批结果',
    align:"center",
    dataIndex: 'status',
    slots: { customRender: 'statusSlot' }
   },
   {
    title: '审批意见',
    align:"center",
    dataIndex: 'remark'
   },
   {
    title: '创建人',
    align:"center",
    dataIndex: 'createBy'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'createTime'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
   label: '申请人',
   field: 'sourcePersonName',
   component: 'Input'
  },
  {
   label: '换班人',
   field: 'targetPersonName',
   component: 'Input'
  },
  {
      label: "审核状态",
      field: 'status',
      component: 'JSelectInput',
      componentProps: {
        options: [
          { label: '待审核', value: '0' },
          { label: '通过', value: '1' },
          { label: '未通过', value: '2' },
        ],
      },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '待换班次',
    field: 'sourceId',
    component: 'Input',
  },
  {
    label: '目标班次',
    field: 'targetId',
    component: 'Input',
  },
  {
    label: '审批状态',
    field: 'status',
    component: 'InputNumber',
  },
  {
    label: '审批意见',
    field: 'remark',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//表单数据
export const formSchemaAudit: FormSchema[] = [
  {
    label: '申请人',
    field: 'sourcePersonName',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '申请人班次',
    field: 'sourcePeriodName',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '申请人班次日期',
    field: 'sourcePersonWorkDate',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '申请人班次上班时间',
    field: 'sourcePeriodWorkTime',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '申请人班次下班时间',
    field: 'sourcePeriodLeaveTime',
    component: 'Input',
	dynamicDisabled:true
  },
  
  {
    label: '换班人',
    field: 'targetPersonName',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '换班人班次',
    field: 'targetPeriodName',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '换班人班次日期',
    field: 'targetPersonWorkDate',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '换班人班次上班时间',
    field: 'targetPeriodWorkTime',
    component: 'Input',
	dynamicDisabled:true
  },
  {
    label: '换班人班次下班时间',
    field: 'targetPeriodLeaveTime',
    component: 'Input',
	dynamicDisabled:true
  },
  
  {
    label: '状态',
    field: 'status',
    component: 'RadioGroup',
    componentProps:{
      options:[
        {
          label:'通过',
          value:1
        },
        {
          label:'不通过',
          value:2
        }
      ]
    },
    // defaultValue: '1',
    show: ({values})=>{
      return values.applyResultId
    },
  },
  {
    label: '意见',
    field: 'resultRemark',
    component: 'InputTextArea',
    show: ({values})=>{
      return values.applyResultId
    },
  },
  {
    label: '',
    field: 'applyResultId',
    component: 'Input',
    show:false,
  },



  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'isAudit',
    defaultValue: 2,
    component: 'Input',
    show: false
  },

  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];
// 高级查询数据
export const superQuerySchema = {
  sourceId: {title: '待换班次',order: 0,view: 'text', type: 'string',},
  targetId: {title: '目标班次',order: 1,view: 'text', type: 'string',},
  status: {title: '审批状态',order: 2,view: 'number', type: 'number',},
  remark: {title: '审批意见',order: 3,view: 'text', type: 'string',},
  createBy: {title: '创建人',order: 4,view: 'text', type: 'string',},
  createTime: {title: '创建时间',order: 5,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 6,view: 'text', type: 'string',},
  updateTime: {title: '更新时间',order: 7,view: 'datetime', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}